package com.ywjt.platformbusiness.home.adapter;

import android.graphics.Paint;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ywjt.platformbusiness.R;
import com.ywjt.platformbusiness.home.CommonModel;
import com.ywjt.platformbusiness.home.model.HomeRecommonGoods;

import java.util.List;

public class HomeRecommondAdapter extends BaseQuickAdapter<HomeRecommonGoods.ResultDTO.RecordsDTO, BaseViewHolder> {

    public HomeRecommondAdapter(@Nullable List<HomeRecommonGoods.ResultDTO.RecordsDTO> data) {
        super(R.layout.item_home_recommond, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, HomeRecommonGoods.ResultDTO.RecordsDTO item) {
        ImageView ivGoodsImg=helper.getView(R.id.ivGoodsImg);
        Glide.with(mContext).load(item.getMainPhoto())
                .into(ivGoodsImg);
        helper.setText(R.id.tvGoodPrice,"¥"+item.getPrice());
        helper.setText(R.id.tvGoodsName,item.getName());
        helper.setText(R.id.tvBuyNum,(item.getSalesVolume()==null?0:item.getSalesVolume())+"已拼");
    }
}
